package com.asset.dispoal.dataDetail.service.commom;

import com.asset.dispoal.dataDetail.domain.db.entity.SysDataDetail;
import com.asset.dispoal.dataDetail.domain.db.mapper.SysDataDetailMapper;
import com.asset.dispoal.dataDetail.dto.SysDataDetailRequest;
import com.asset.dispoal.dataDetail.service.converter.SysDataDetailConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/3/23$
 */
@Component
public class DataDetailUpdateCommand implements BaseCommand<SysDataDetailRequest, Result> {

    @Autowired
    SysDataDetailMapper sysDataDetailMapper;

    @Override
    public Result execute(SysDataDetailRequest request) {
        SysDataDetail sysDataDetail = SysDataDetailConverter.INSTANCE.reqToDo(request);
        sysDataDetailMapper.update(sysDataDetail);
        return Result.ok();
    }
}
